﻿#ifndef COMPANY_H
#define COMPANY_H

#include <QObject>
#include "tools.h"

class Company : public QObject
{
    Q_OBJECT
public:
    explicit Company(QObject *parent = nullptr);

    enum CategoryType{
        ProductCategory=0,
        ClientCategory=1,
        GiverCategory=2,
        FinanceCategory=3
    };

    Q_ENUM(CategoryType)

    int id;
    QString companyId;
    QString taxRate;

    QString companyName;
    QString contact;
    QString tel;
    QString fax;
    QString website;
    QString email;
    QString province;
    QString city;
    QString district;
    QString address;
    QString account;
    QString introduction;

    QString ticketCompanyName;
    QString taxNum;
    QString bank;
    QString ticketAccount;
    QString ticketTel;
    QString ticketAddress;

    double totalTicket;
    double totalMoney;
    double ticketIn;
    double ticketOut;
    double moneyIn;
    double moneyOut;

    QString clientCategory;
    QString giverCategory;
    QString productCategory;
    QString financeCategory;

    void loadFromJsonObject(QJsonObject obj);

    void saveToSettings();

    static void setCompanyId(QString companyId){
        MySettings.setValue("company/companyId", companyId);
    }

    static QString getCompanyId(){
        return MySettings.value("company/companyId").toString();
    }

    static void setTaxRate(QString taxRate){
        MySettings.setValue("company/taxRate", taxRate);
    }

    static QString getTaxRate(){
        return MySettings.value("company/taxRate").toString();
    }

    static void setCompanyName(QString companyName){
        MySettings.setValue("company/companyName", companyName);
    }

    static QString getCompanyName(){
        return MySettings.value("company/companyName").toString();
    }

    static void setContact(QString contact){
        MySettings.setValue("company/contact", contact);
    }

    static QString getContact(){
        return MySettings.value("company/contact").toString();
    }

    static void setTel(QString tel){
        MySettings.setValue("company/tel", tel);
    }

    static QString getTel(){
        return MySettings.value("company/tel").toString();
    }

    static void setFax(QString fax){
        MySettings.setValue("company/fax", fax);
    }

    static QString getFax(){
        return MySettings.value("company/fax").toString();
    }

    static void setWebsite(QString website){
        MySettings.setValue("company/website", website);
    }

    static QString getWebsite(){
        return MySettings.value("company/website").toString();
    }

    static void setEmail(QString email){
        MySettings.setValue("company/email", email);
    }

    static QString getEmail(){
        return MySettings.value("company/email").toString();
    }

    static void setProvince(QString province){
        MySettings.setValue("company/province", province);
    }

    static QString getProvince(){
        return MySettings.value("company/province").toString();
    }

    static void setCity(QString city){
        MySettings.setValue("company/city", city);
    }

    static QString getCity(){
        return MySettings.value("company/city").toString();
    }

    static void setDistrict(QString district){
        MySettings.setValue("company/district", district);
    }

    static QString getDistrict(){
        return MySettings.value("company/district").toString();
    }

    static void setAddress(QString address){
        MySettings.setValue("company/address", address);
    }

    static QString getAddress(){
        return MySettings.value("company/address").toString();
    }

    static void setAccount(QString account){
        MySettings.setValue("company/account", account);
    }

    static QString getAccount(){
        return MySettings.value("company/account").toString();
    }

    static void setIntroduction(QString introduction){
        MySettings.setValue("company/introduction", introduction);
    }

    static QString getIntroduction(){
        return MySettings.value("company/introduction").toString();
    }

    static void setTicketCompanyName(QString ticketCompanyName){
        MySettings.setValue("company/ticketCompanyName", ticketCompanyName);
    }

    static QString getTicketCompanyName(){
        return MySettings.value("company/ticketCompanyName").toString();
    }

    static void setTaxNum(QString taxNum){
        MySettings.setValue("company/taxNum", taxNum);
    }

    static QString getTaxNum(){
        return MySettings.value("company/taxNum").toString();
    }

    static void setBank(QString bank){
        MySettings.setValue("company/bank", bank);
    }

    static QString getBank(){
        return MySettings.value("company/bank").toString();
    }

    static void setTicketAccount(QString ticketAccount){
        MySettings.setValue("company/ticketAccount", ticketAccount);
    }

    static QString getTicketAccount(){
        return MySettings.value("company/ticketAccount").toString();
    }

    static void setTicketTel(QString ticketTel){
        MySettings.setValue("company/ticketTel", ticketTel);
    }

    static QString getTicketTel(){
        return MySettings.value("company/ticketTel").toString();
    }

    static void setTicketAddress(QString ticketAddress){
        MySettings.setValue("company/ticketAddress", ticketAddress);
    }

    static QString getTicketAddress(){
        return MySettings.value("company/ticketAddress").toString();
    }

    static void setTotalTicket(double totalTicket){
        MySettings.setValue("company/totalTicket", totalTicket);
    }

    static double getTotalTicket(){
        return MySettings.value("company/totalTicket").toDouble();
    }

    static void setTotalMoney(double totalMoney){
        MySettings.setValue("company/totalMoney", totalMoney);
    }

    static double getTotalMoney(){
        return MySettings.value("company/totalMoney").toDouble();
    }

    static void setTicketIn(double ticketIn){
        MySettings.setValue("company/ticketIn", ticketIn);
    }

    static double getTicketIn(){
        return MySettings.value("company/ticketIn").toDouble();
    }

    static void setTicketOut(double ticketOut){
        MySettings.setValue("company/ticketOut", ticketOut);
    }

    static double getTicketOut(){
        return MySettings.value("company/ticketOut").toDouble();
    }

    static void setMoneyIn(double moneyIn){
        MySettings.setValue("company/moneyIn", moneyIn);
    }

    static double getMoneyIn(){
        return MySettings.value("company/moneyIn").toDouble();
    }

    static void setMoneyOut(double moneyOut){
        MySettings.setValue("company/moneyOut", moneyOut);
    }

    static double getMoneyOut(){
        return MySettings.value("company/moneyOut").toDouble();
    }

    static void setClientCategory(QString clientCategory){
        MySettings.setValue("company/clientCategory", clientCategory);
    }

    static QString getClientCategory(){
        return MySettings.value("company/clientCategory").toString();
    }

    static void setGiverCategory(QString giverCategory){
        MySettings.setValue("company/giverCategory", giverCategory);
    }

    static QString getGiverCategory(){
        return MySettings.value("company/giverCategory").toString();
    }

    static void setProductCategory(QString productCategory){
        MySettings.setValue("company/productCategory", productCategory);
    }

    static QString getProductCategory(){
        return MySettings.value("company/productCategory").toString();
    }

    static void setFinanceCategory(QString financeCategory){
        MySettings.setValue("company/financeCategory", financeCategory);
    }

    static QString getFinanceCategory(){
        return MySettings.value("company/financeCategory").toString();
    }

signals:

public slots:
};

#endif // COMPANY_H
